3.335 \(\int \frac{\cos ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^3} \, dx\)

Optimal. Leaf size=393 \[ -\frac{\left (-21 a^2 A b^3+6 a^4 A b+11 a^3 b^2 B-2 a^5 B-6 a b^4 B+12 A b^5\right ) \sin (c+d x)}{2 a^4 d \left (a^2-b^2\right )^2}+\frac{\left (-10 a^2 A b^2+a^4 A+6 a^3 b B-3 a b^3 B+6 A b^4\right ) \sin (c+d x) \cos (c+d x)}{2 a^3 d \left (a^2-b^2\right )^2}-\frac{b^2 \left (-29 a^2 A b^3+20 a^4 A b+15 a^3 b^2 B-12 a^5 B-6 a b^4 B+12 A b^5\right ) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{a^5 d (a-b)^{5/2} (a+b)^{5/2}}+\frac{b \left (7 a^2 A b-5 a^3 B+2 a b^2 B-4 A b^3\right ) \sin (c+d x) \cos (c+d x)}{2 a^2 d \left (a^2-b^2\right )^2 (a+b \sec (c+d x))}+\frac{b (A b-a B) \sin (c+d x) \cos (c+d x)}{2 a d \left (a^2-b^2\right ) (a+b \sec (c+d x))^2}+\frac{x \left (a^2 A-6 a b B+12 A b^2\right )}{2 a^5} \]

[Out]

((a^2*A + 12*A*b^2 - 6*a*b*B)*x)/(2*a^5) - (b^2*(20*a^4*A*b - 29*a^2*A*b^3 + 12*A*b^5 - 12*a^5*B + 15*a^3*b^2*
B - 6*a*b^4*B)*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a^5*(a - b)^(5/2)*(a + b)^(5/2)*d) - ((6*
a^4*A*b - 21*a^2*A*b^3 + 12*A*b^5 - 2*a^5*B + 11*a^3*b^2*B - 6*a*b^4*B)*Sin[c + d*x])/(2*a^4*(a^2 - b^2)^2*d)
+ ((a^4*A - 10*a^2*A*b^2 + 6*A*b^4 + 6*a^3*b*B - 3*a*b^3*B)*Cos[c + d*x]*Sin[c + d*x])/(2*a^3*(a^2 - b^2)^2*d)
 + (b*(A*b - a*B)*Cos[c + d*x]*Sin[c + d*x])/(2*a*(a^2 - b^2)*d*(a + b*Sec[c + d*x])^2) + (b*(7*a^2*A*b - 4*A*
b^3 - 5*a^3*B + 2*a*b^2*B)*Cos[c + d*x]*Sin[c + d*x])/(2*a^2*(a^2 - b^2)^2*d*(a + b*Sec[c + d*x]))

________________________________________________________________________________________

Rubi [A]  time = 1.99893, antiderivative size = 393, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 7, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.226, Rules used = {4030, 4100, 4104, 3919, 3831, 2659, 208} \[ -\frac{\left (-21 a^2 A b^3+6 a^4 A b+11 a^3 b^2 B-2 a^5 B-6 a b^4 B+12 A b^5\right ) \sin (c+d x)}{2 a^4 d \left (a^2-b^2\right )^2}+\frac{\left (-10 a^2 A b^2+a^4 A+6 a^3 b B-3 a b^3 B+6 A b^4\right ) \sin (c+d x) \cos (c+d x)}{2 a^3 d \left (a^2-b^2\right )^2}-\frac{b^2 \left (-29 a^2 A b^3+20 a^4 A b+15 a^3 b^2 B-12 a^5 B-6 a b^4 B+12 A b^5\right ) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{a^5 d (a-b)^{5/2} (a+b)^{5/2}}+\frac{b \left (7 a^2 A b-5 a^3 B+2 a b^2 B-4 A b^3\right ) \sin (c+d x) \cos (c+d x)}{2 a^2 d \left (a^2-b^2\right )^2 (a+b \sec (c+d x))}+\frac{b (A b-a B) \sin (c+d x) \cos (c+d x)}{2 a d \left (a^2-b^2\right ) (a+b \sec (c+d x))^2}+\frac{x \left (a^2 A-6 a b B+12 A b^2\right )}{2 a^5} \]

Antiderivative was successfully verified.

[In]

Int[(Cos[c + d*x]^2*(A + B*Sec[c + d*x]))/(a + b*Sec[c + d*x])^3,x]

[Out]

((a^2*A + 12*A*b^2 - 6*a*b*B)*x)/(2*a^5) - (b^2*(20*a^4*A*b - 29*a^2*A*b^3 + 12*A*b^5 - 12*a^5*B + 15*a^3*b^2*
B - 6*a*b^4*B)*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a^5*(a - b)^(5/2)*(a + b)^(5/2)*d) - ((6*
a^4*A*b - 21*a^2*A*b^3 + 12*A*b^5 - 2*a^5*B + 11*a^3*b^2*B - 6*a*b^4*B)*Sin[c + d*x])/(2*a^4*(a^2 - b^2)^2*d)
+ ((a^4*A - 10*a^2*A*b^2 + 6*A*b^4 + 6*a^3*b*B - 3*a*b^3*B)*Cos[c + d*x]*Sin[c + d*x])/(2*a^3*(a^2 - b^2)^2*d)
 + (b*(A*b - a*B)*Cos[c + d*x]*Sin[c + d*x])/(2*a*(a^2 - b^2)*d*(a + b*Sec[c + d*x])^2) + (b*(7*a^2*A*b - 4*A*
b^3 - 5*a^3*B + 2*a*b^2*B)*Cos[c + d*x]*Sin[c + d*x])/(2*a^2*(a^2 - b^2)^2*d*(a + b*Sec[c + d*x]))

Rule 4030

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*
(B_.) + (A_)), x_Symbol] :> Simp[(b*(A*b - a*B)*Cot[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n)/
(a*f*(m + 1)*(a^2 - b^2)), x] + Dist[1/(a*(m + 1)*(a^2 - b^2)), Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*
x])^n*Simp[A*(a^2*(m + 1) - b^2*(m + n + 1)) + a*b*B*n - a*(A*b - a*B)*(m + 1)*Csc[e + f*x] + b*(A*b - a*B)*(m
 + n + 2)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b
^2, 0] && LtQ[m, -1] &&  !(ILtQ[m + 1/2, 0] && ILtQ[n, 0])

Rule 4100

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Simp[((A*b^2 - a*b*B + a^2*C)*Cot[e + f*x]*(a +
 b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n)/(a*f*(m + 1)*(a^2 - b^2)), x] + Dist[1/(a*(m + 1)*(a^2 - b^2)), I
nt[(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n*Simp[a*(a*A - b*B + a*C)*(m + 1) - (A*b^2 - a*b*B + a^2*C)*
(m + n + 1) - a*(A*b - a*B + b*C)*(m + 1)*Csc[e + f*x] + (A*b^2 - a*b*B + a^2*C)*(m + n + 2)*Csc[e + f*x]^2, x
], x], x] /; FreeQ[{a, b, d, e, f, A, B, C, n}, x] && NeQ[a^2 - b^2, 0] && LtQ[m, -1] &&  !(ILtQ[m + 1/2, 0] &
& ILtQ[n, 0])

Rule 4104

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Simp[(A*Cot[e + f*x]*(a + b*Csc[e + f*x])^(m +
1)*(d*Csc[e + f*x])^n)/(a*f*n), x] + Dist[1/(a*d*n), Int[(a + b*Csc[e + f*x])^m*(d*Csc[e + f*x])^(n + 1)*Simp[
a*B*n - A*b*(m + n + 1) + a*(A + A*n + C*n)*Csc[e + f*x] + A*b*(m + n + 2)*Csc[e + f*x]^2, x], x], x] /; FreeQ
[{a, b, d, e, f, A, B, C, m}, x] && NeQ[a^2 - b^2, 0] && LeQ[n, -1]

Rule 3919

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(c*x)/a,
x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[
b*c - a*d, 0]

Rule 3831

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[1/b, Int[1/(1 + (a*Sin[e
 + f*x])/b), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rubi steps

\begin{align*} \int \frac{\cos ^2(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^3} \, dx &=\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}-\frac{\int \frac{\cos ^2(c+d x) \left (-2 \left (a^2 A-2 A b^2+a b B\right )+2 a (A b-a B) \sec (c+d x)-3 b (A b-a B) \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^2} \, dx}{2 a \left (a^2-b^2\right )}\\ &=\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}+\frac{\int \frac{\cos ^2(c+d x) \left (2 \left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right )-a \left (4 a^2 A b-A b^3-2 a^3 B-a b^2 B\right ) \sec (c+d x)+2 b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{2 a^2 \left (a^2-b^2\right )^2}\\ &=\frac{\left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^3 \left (a^2-b^2\right )^2 d}+\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac{\int \frac{\cos (c+d x) \left (2 \left (6 a^4 A b-21 a^2 A b^3+12 A b^5-2 a^5 B+11 a^3 b^2 B-6 a b^4 B\right )-2 a \left (a^4 A+4 a^2 A b^2-2 A b^4-4 a^3 b B+a b^3 B\right ) \sec (c+d x)-2 b \left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{4 a^3 \left (a^2-b^2\right )^2}\\ &=-\frac{\left (6 a^4 A b-21 a^2 A b^3+12 A b^5-2 a^5 B+11 a^3 b^2 B-6 a b^4 B\right ) \sin (c+d x)}{2 a^4 \left (a^2-b^2\right )^2 d}+\frac{\left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^3 \left (a^2-b^2\right )^2 d}+\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}+\frac{\int \frac{2 \left (a^2-b^2\right )^2 \left (a^2 A+12 A b^2-6 a b B\right )+2 a b \left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{4 a^4 \left (a^2-b^2\right )^2}\\ &=\frac{\left (a^2 A+12 A b^2-6 a b B\right ) x}{2 a^5}-\frac{\left (6 a^4 A b-21 a^2 A b^3+12 A b^5-2 a^5 B+11 a^3 b^2 B-6 a b^4 B\right ) \sin (c+d x)}{2 a^4 \left (a^2-b^2\right )^2 d}+\frac{\left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^3 \left (a^2-b^2\right )^2 d}+\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac{\left (b^2 \left (20 a^4 A b-29 a^2 A b^3+12 A b^5-12 a^5 B+15 a^3 b^2 B-6 a b^4 B\right )\right ) \int \frac{\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{2 a^5 \left (a^2-b^2\right )^2}\\ &=\frac{\left (a^2 A+12 A b^2-6 a b B\right ) x}{2 a^5}-\frac{\left (6 a^4 A b-21 a^2 A b^3+12 A b^5-2 a^5 B+11 a^3 b^2 B-6 a b^4 B\right ) \sin (c+d x)}{2 a^4 \left (a^2-b^2\right )^2 d}+\frac{\left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^3 \left (a^2-b^2\right )^2 d}+\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac{\left (b \left (20 a^4 A b-29 a^2 A b^3+12 A b^5-12 a^5 B+15 a^3 b^2 B-6 a b^4 B\right )\right ) \int \frac{1}{1+\frac{a \cos (c+d x)}{b}} \, dx}{2 a^5 \left (a^2-b^2\right )^2}\\ &=\frac{\left (a^2 A+12 A b^2-6 a b B\right ) x}{2 a^5}-\frac{\left (6 a^4 A b-21 a^2 A b^3+12 A b^5-2 a^5 B+11 a^3 b^2 B-6 a b^4 B\right ) \sin (c+d x)}{2 a^4 \left (a^2-b^2\right )^2 d}+\frac{\left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^3 \left (a^2-b^2\right )^2 d}+\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac{\left (b \left (20 a^4 A b-29 a^2 A b^3+12 A b^5-12 a^5 B+15 a^3 b^2 B-6 a b^4 B\right )\right ) \operatorname{Subst}\left (\int \frac{1}{1+\frac{a}{b}+\left (1-\frac{a}{b}\right ) x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{a^5 \left (a^2-b^2\right )^2 d}\\ &=\frac{\left (a^2 A+12 A b^2-6 a b B\right ) x}{2 a^5}-\frac{b^2 \left (20 a^4 A b-29 a^2 A b^3+12 A b^5-12 a^5 B+15 a^3 b^2 B-6 a b^4 B\right ) \tanh ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{a^5 (a-b)^{5/2} (a+b)^{5/2} d}-\frac{\left (6 a^4 A b-21 a^2 A b^3+12 A b^5-2 a^5 B+11 a^3 b^2 B-6 a b^4 B\right ) \sin (c+d x)}{2 a^4 \left (a^2-b^2\right )^2 d}+\frac{\left (a^4 A-10 a^2 A b^2+6 A b^4+6 a^3 b B-3 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^3 \left (a^2-b^2\right )^2 d}+\frac{b (A b-a B) \cos (c+d x) \sin (c+d x)}{2 a \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac{b \left (7 a^2 A b-4 A b^3-5 a^3 B+2 a b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}\\ \end{align*}

Mathematica [A]  time = 4.25608, size = 734, normalized size = 1.87 \[ \frac{\frac{16 a b \left (a^2-b^2\right )^2 (c+d x) \left (a^2 A-6 a b B+12 A b^2\right ) \cos (c+d x)+4 \left (a^3-a b^2\right )^2 (c+d x) \left (a^2 A-6 a b B+12 A b^2\right ) \cos (2 (c+d x))-48 a^6 A b^2 \sin (2 (c+d x))-2 a^6 A b^2 \sin (4 (c+d x))-32 a^5 A b^3 \sin (c+d x)+16 a^5 A b^3 \sin (3 (c+d x))+130 a^4 A b^4 \sin (2 (c+d x))+a^4 A b^4 \sin (4 (c+d x))+160 a^3 A b^5 \sin (c+d x)-8 a^3 A b^5 \sin (3 (c+d x))-72 a^2 A b^6 \sin (2 (c+d x))+48 a^6 A b^2 c-12 a^4 A b^4 c-136 a^2 A b^6 c+48 a^6 A b^2 d x-12 a^4 A b^4 d x-136 a^2 A b^6 d x-8 a^7 A b \sin (c+d x)-8 a^7 A b \sin (3 (c+d x))+2 a^8 A \sin (2 (c+d x))+a^8 A \sin (4 (c+d x))+4 a^8 A c+4 a^8 A d x+8 a^6 b^2 B \sin (c+d x)-8 a^6 b^2 B \sin (3 (c+d x))-64 a^5 b^3 B \sin (2 (c+d x))-84 a^4 b^4 B \sin (c+d x)+4 a^4 b^4 B \sin (3 (c+d x))+36 a^3 b^5 B \sin (2 (c+d x))+48 a^2 b^6 B \sin (c+d x)+72 a^3 b^5 B c+72 a^3 b^5 B d x+16 a^7 b B \sin (2 (c+d x))-24 a^7 b B c-24 a^7 b B d x+4 a^8 B \sin (c+d x)+4 a^8 B \sin (3 (c+d x))-96 a A b^7 \sin (c+d x)-48 a b^7 B c-48 a b^7 B d x+96 A b^8 c+96 A b^8 d x}{\left (a^2-b^2\right )^2 (a \cos (c+d x)+b)^2}+\frac{16 b^2 \left (-29 a^2 A b^3+20 a^4 A b+15 a^3 b^2 B-12 a^5 B-6 a b^4 B+12 A b^5\right ) \tanh ^{-1}\left (\frac{(b-a) \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2}}}{16 a^5 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(Cos[c + d*x]^2*(A + B*Sec[c + d*x]))/(a + b*Sec[c + d*x])^3,x]

[Out]

((16*b^2*(20*a^4*A*b - 29*a^2*A*b^3 + 12*A*b^5 - 12*a^5*B + 15*a^3*b^2*B - 6*a*b^4*B)*ArcTanh[((-a + b)*Tan[(c
 + d*x)/2])/Sqrt[a^2 - b^2]])/(a^2 - b^2)^(5/2) + (4*a^8*A*c + 48*a^6*A*b^2*c - 12*a^4*A*b^4*c - 136*a^2*A*b^6
*c + 96*A*b^8*c - 24*a^7*b*B*c + 72*a^3*b^5*B*c - 48*a*b^7*B*c + 4*a^8*A*d*x + 48*a^6*A*b^2*d*x - 12*a^4*A*b^4
*d*x - 136*a^2*A*b^6*d*x + 96*A*b^8*d*x - 24*a^7*b*B*d*x + 72*a^3*b^5*B*d*x - 48*a*b^7*B*d*x + 16*a*b*(a^2 - b
^2)^2*(a^2*A + 12*A*b^2 - 6*a*b*B)*(c + d*x)*Cos[c + d*x] + 4*(a^3 - a*b^2)^2*(a^2*A + 12*A*b^2 - 6*a*b*B)*(c
+ d*x)*Cos[2*(c + d*x)] - 8*a^7*A*b*Sin[c + d*x] - 32*a^5*A*b^3*Sin[c + d*x] + 160*a^3*A*b^5*Sin[c + d*x] - 96
*a*A*b^7*Sin[c + d*x] + 4*a^8*B*Sin[c + d*x] + 8*a^6*b^2*B*Sin[c + d*x] - 84*a^4*b^4*B*Sin[c + d*x] + 48*a^2*b
^6*B*Sin[c + d*x] + 2*a^8*A*Sin[2*(c + d*x)] - 48*a^6*A*b^2*Sin[2*(c + d*x)] + 130*a^4*A*b^4*Sin[2*(c + d*x)]
- 72*a^2*A*b^6*Sin[2*(c + d*x)] + 16*a^7*b*B*Sin[2*(c + d*x)] - 64*a^5*b^3*B*Sin[2*(c + d*x)] + 36*a^3*b^5*B*S
in[2*(c + d*x)] - 8*a^7*A*b*Sin[3*(c + d*x)] + 16*a^5*A*b^3*Sin[3*(c + d*x)] - 8*a^3*A*b^5*Sin[3*(c + d*x)] +
4*a^8*B*Sin[3*(c + d*x)] - 8*a^6*b^2*B*Sin[3*(c + d*x)] + 4*a^4*b^4*B*Sin[3*(c + d*x)] + a^8*A*Sin[4*(c + d*x)
] - 2*a^6*A*b^2*Sin[4*(c + d*x)] + a^4*A*b^4*Sin[4*(c + d*x)])/((a^2 - b^2)^2*(b + a*Cos[c + d*x])^2))/(16*a^5
*d)

________________________________________________________________________________________

Maple [B]  time = 0.134, size = 1552, normalized size = 4. \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^3,x)

[Out]

-6/d/a^4/(1+tan(1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an(1/2*d*x+1/2*c))*A*b^2-6/d/a^4*arctan(tan(1
/2*d*x+1/2*c))*B*b+12/d/(a^4-2*a^2*b^2+b^4)/((a+b)*(a-b))^(1/2)*arctanh((a-b)*tan(1/2*d*x+1/2*c)/((a+b)*(a-b))
^(1/2))*B*b^2-1/d/a^3/(1+tan(1/2*d*x+1/2*c)^2)^2*tan(1/2*d*x+1/2*c)^3*A

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^3,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 1.11101, size = 4018, normalized size = 10.22 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^3,x, algorithm="fricas")

[Out]

[1/4*(2*(A*a^10 - 6*B*a^9*b + 9*A*a^8*b^2 + 18*B*a^7*b^3 - 33*A*a^6*b^4 - 18*B*a^5*b^5 + 35*A*a^4*b^6 + 6*B*a^
3*b^7 - 12*A*a^2*b^8)*d*x*cos(d*x + c)^2 + 4*(A*a^9*b - 6*B*a^8*b^2 + 9*A*a^7*b^3 + 18*B*a^6*b^4 - 33*A*a^5*b^
5 - 18*B*a^4*b^6 + 35*A*a^3*b^7 + 6*B*a^2*b^8 - 12*A*a*b^9)*d*x*cos(d*x + c) + 2*(A*a^8*b^2 - 6*B*a^7*b^3 + 9*
A*a^6*b^4 + 18*B*a^5*b^5 - 33*A*a^4*b^6 - 18*B*a^3*b^7 + 35*A*a^2*b^8 + 6*B*a*b^9 - 12*A*b^10)*d*x - (12*B*a^5
*b^4 - 20*A*a^4*b^5 - 15*B*a^3*b^6 + 29*A*a^2*b^7 + 6*B*a*b^8 - 12*A*b^9 + (12*B*a^7*b^2 - 20*A*a^6*b^3 - 15*B
*a^5*b^4 + 29*A*a^4*b^5 + 6*B*a^3*b^6 - 12*A*a^2*b^7)*cos(d*x + c)^2 + 2*(12*B*a^6*b^3 - 20*A*a^5*b^4 - 15*B*a
^4*b^5 + 29*A*a^3*b^6 + 6*B*a^2*b^7 - 12*A*a*b^8)*cos(d*x + c))*sqrt(a^2 - b^2)*log((2*a*b*cos(d*x + c) - (a^2
 - 2*b^2)*cos(d*x + c)^2 - 2*sqrt(a^2 - b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^2)/(a^2*cos(d*x + c
)^2 + 2*a*b*cos(d*x + c) + b^2)) + 2*(2*B*a^8*b^2 - 6*A*a^7*b^3 - 13*B*a^6*b^4 + 27*A*a^5*b^5 + 17*B*a^4*b^6 -
 33*A*a^3*b^7 - 6*B*a^2*b^8 + 12*A*a*b^9 + (A*a^10 - 3*A*a^8*b^2 + 3*A*a^6*b^4 - A*a^4*b^6)*cos(d*x + c)^3 + 2
*(B*a^10 - 2*A*a^9*b - 3*B*a^8*b^2 + 6*A*a^7*b^3 + 3*B*a^6*b^4 - 6*A*a^5*b^5 - B*a^4*b^6 + 2*A*a^3*b^7)*cos(d*
x + c)^2 + (4*B*a^9*b - 11*A*a^8*b^2 - 20*B*a^7*b^3 + 43*A*a^6*b^4 + 25*B*a^5*b^5 - 50*A*a^4*b^6 - 9*B*a^3*b^7
 + 18*A*a^2*b^8)*cos(d*x + c))*sin(d*x + c))/((a^13 - 3*a^11*b^2 + 3*a^9*b^4 - a^7*b^6)*d*cos(d*x + c)^2 + 2*(
a^12*b - 3*a^10*b^3 + 3*a^8*b^5 - a^6*b^7)*d*cos(d*x + c) + (a^11*b^2 - 3*a^9*b^4 + 3*a^7*b^6 - a^5*b^8)*d), 1
/2*((A*a^10 - 6*B*a^9*b + 9*A*a^8*b^2 + 18*B*a^7*b^3 - 33*A*a^6*b^4 - 18*B*a^5*b^5 + 35*A*a^4*b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b^6 - 9*B*a^3
*b^7 + 18*A*a^2*b^8)*cos(d*x + c))*sin(d*x + c))/((a^13 - 3*a^11*b^2 + 3*a^9*b^4 - a^7*b^6)*d*cos(d*x + c)^2 +
 2*(a^12*b - 3*a^10*b^3 + 3*a^8*b^5 - a^6*b^7)*d*cos(d*x + c) + (a^11*b^2 - 3*a^9*b^4 + 3*a^7*b^6 - a^5*b^8)*d
)]

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (A + B \sec{\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}}{\left (a + b \sec{\left (c + d x \right )}\right )^{3}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))**3,x)

[Out]

Integral((A + B*sec(c + d*x))*cos(c + d*x)**2/(a + b*sec(c + d*x))**3, x)

________________________________________________________________________________________

Giac [B]  time = 1.53663, size = 1827, normalized size = 4.65 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^3,x, algorithm="giac")

[Out]

1/2*(2*(12*B*a^5*b^2 - 20*A*a^4*b^3 - 15*B*a^3*b^4 + 29*A*a^2*b^5 + 6*B*a*b^6 - 12*A*b^7)*(pi*floor(1/2*(d*x +
 c)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt(-a^2 + b^2)))/(
(a^9 - 2*a^7*b^2 + a^5*b^4)*sqrt(-a^2 + b^2)) - 2*(A*a^7*tan(1/2*d*x + 1/2*c)^7 - 2*B*a^7*tan(1/2*d*x + 1/2*c)
^7 + 4*A*a^6*b*tan(1/2*d*x + 1/2*c)^7 + 4*B*a^6*b*tan(1/2*d*x + 1/2*c)^7 - 13*A*a^5*b^2*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